package com.example.common.vo;

import com.example.sys.entity.User;
import lombok.*;

import java.util.List;

@AllArgsConstructor
public class Result<T> {
    private Integer code;
    private String message;
    private T data;

    public static <T> Result<T> sucess(T data)
    {
        return new Result<>(20000,"sucess",data);
    }

    public static <T> Result<T> sucess()
    {
        return new Result<T>(20000,"sucess",null);
    }

    public static <T> Result<T> sucess(T data,String message)
    {
        return new Result<>(20000,message,data);
    }

    public static <T> Result<T> sucess(String message)
    {
        return new Result<>(20000,message,null);
    }

    public static <T> Result<T> fail()
    {
        return new Result<>(20001,"fail",null);
    }

    public static <T> Result<T> fail(Integer code)
    {
        return new Result<>(code,"fail",null);
    }

    public static <T> Result<T> fail(Integer code,String message)
    {
        return new Result<>(code,message,null);
    }

    public static <T> Result<T> fail(String message)
    {
        return new Result<>(20001,message,null);
    }
}
